package com.lvzero.answer.controller;

import com.lvzero.answer.common.Result;
import com.lvzero.answer.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 用户相关的controller
 */
@Api(tags = "首页模块")
@RestController
@CrossOrigin
@RequestMapping("api")
public class UserController {

    @Autowired
    UserService userService;

    /**
     * 答题完成后，分享完成了，存入数据库；
     */
    @ApiOperation(value = "分享操作后调用",httpMethod = "POST")
    @RequestMapping("user/share_ok")
    public Result shareOk(@RequestBody Map map) {
        return userService.shareOk(map);
    }

    /**
     * 获奖后填写更新用户信息
     */
    @ApiOperation(value = "中奖后更新用户信息",httpMethod = "POST")
    @RequestMapping("user/update")
    public Result updateUser(@RequestBody Map map) {
        return  userService.updateUser(map);
    }


}
